﻿using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using GMS.BIZ;

public partial class Information_StuInformation : System.Web.UI.Page
{
    protected void Page_LoadComplete(object sender, EventArgs e)
    {
        if (!((Account)Session["Account"]).RoleCurrent.Equals('s')) Response.Redirect("Default.aspx");
        
        Student mystudent = (Student)Session["Student"];
        if (mystudent.StudentName == "")
        {
            Label_completeinfo.Visible = true;
           // Response.Redirect("StuInformation.aspx");
        }
        else Label_completeinfo.Visible = false;
        Label_stdid.Text = mystudent.StudentID;
        Label_classid.Text = mystudent.ClassID;
        Label_graduateyear.Text = mystudent.GraduateYear;
        Label_stdname.Text = mystudent.StudentName;
        Label_stdmail.Text = mystudent.StudentMail;
        Label_stdgender.Text = mystudent.StudentGender;
        Label_stdpolicy.Text = mystudent.StudentPolicy;
        Label_stdhobby.Text = mystudent.StudentHobby;

        GridView_Company.DataSource = mystudent.Companys.GetDataSet();
        GridView_Company.DataBind();

        GridView_English.DataSource = mystudent.Englishs.GetDataSet();
        GridView_English.DataBind();

        GridView_Computer.DataSource = mystudent.Computers.GetDataSet();
        GridView_Computer.DataBind();

        GridView_Job.DataSource = mystudent.Jobs.GetDataSet();
        GridView_Job.DataBind();
    }

    
    protected void Image_PersonalInfo_Click(object sender, ImageClickEventArgs e)
    {
        Response.Redirect("StuInformationEdit.aspx");
    }

    protected void Image_Company_Click(object sender, ImageClickEventArgs e)
    {
        Response.Redirect("CompanyEdit.aspx");
    }

    protected void Image_English_Click(object sender, ImageClickEventArgs e)
    {
        Response.Redirect("EnglishEdit.aspx");
    }

    protected void Image_Job_Click(object sender, ImageClickEventArgs e)
    {
        Response.Redirect("JobEdit.aspx");
    }

    protected void Image_Computer_Click(object sender, ImageClickEventArgs e)
    {
        Response.Redirect("ComputerEdit.aspx");
    }

    protected void GridView_Company_PageIndexChanging(object sender, GridViewPageEventArgs e)
    {
        GridView_Company.PageIndex = e.NewPageIndex;
        Student mystudent = (Student)Session["Student"];
        GridView_Company.DataSource = mystudent.Companys.GetDataSet();
        GridView_Company.DataBind();
    }
     protected void GridView_English_PageIndexChanging(object sender, GridViewPageEventArgs e)
     {
        GridView_English.PageIndex = e.NewPageIndex;
        Student mystudent = (Student)Session["Student"];
        GridView_English.DataSource = mystudent.Englishs.GetDataSet();
        GridView_English.DataBind();
     }
     protected void GridView_Job_PageIndexChanging(object sender, GridViewPageEventArgs e)
     {
         GridView_Job.PageIndex = e.NewPageIndex;
         Student mystudent = (Student)Session["Student"];
         GridView_Job.DataSource = mystudent.Jobs.GetDataSet();
         GridView_Job.DataBind();
     }

     protected void GridView_Computer_PageIndexChanging(object sender, GridViewPageEventArgs e)
     {
         GridView_Computer.PageIndex = e.NewPageIndex;
         Student mystudent = (Student)Session["Student"];
         GridView_Computer.DataSource = mystudent.Computers.GetDataSet();
         GridView_Computer.DataBind();
     }



     protected void GridView_Company_RowDataBound(object sender, GridViewRowEventArgs e)
     {
        
   
             if (e.Row.RowType == DataControlRowType.DataRow)
             {
                     switch (int.Parse(e.Row.Cells[1].Text))
                     {
                         case 1: e.Row.Cells[1].Text = Company.GetCompanyStyleName(1); break;
                         case 2: e.Row.Cells[1].Text = Company.GetCompanyStyleName(2); break;
                         case 3: e.Row.Cells[1].Text = Company.GetCompanyStyleName(3); break;
                         case 4: e.Row.Cells[1].Text = Company.GetCompanyStyleName(4); break;
                         default: break;
                     }
                     switch (int.Parse(e.Row.Cells[6].Text))
                     {
                         case 1: e.Row.Cells[6].Text = "是"; break;
                         case 0: e.Row.Cells[6].Text = "否"; break;
                         default: break;
                     }
  
             }
      
     }
}
